﻿namespace ApiLib.RCL;

/// <summary>
/// WebApp
/// </summary>
public static class WebApp
{
    /// <summary>
    /// 服务提供者
    /// </summary>
    public static IServiceProvider ServiceProvider { get; set; }

    /// <summary>
    /// 接口主机地址
    /// </summary>
    public static string Host { get; set; } = "";

    /// <summary>
    /// 初始化ApiLib
    /// <code>
    /// var host = builder.Build();
    /// host.Services.InitApiLib(SiteConfig.BusinessHost);
    /// await host.RunAsync();
    /// </code>
    /// </summary>
    /// <param name="serviceProvider"></param>
    /// <param name="host"></param>
    public static void InitApiLib(this IServiceProvider serviceProvider, string host)
    {
        Host = host;
        ServiceProvider = serviceProvider;
    }
}